package o;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class dfy {
    public static void ˏ(Collection<File> collection, File file) throws IOException {
        ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file), 1048576));
        for (File ॱ : collection) {
            ॱ(ॱ, zipOutputStream, "");
        }
        zipOutputStream.close();
    }

    private static void ॱ(File file, ZipOutputStream zipOutputStream, String str) throws FileNotFoundException, IOException {
        Closeable bufferedInputStream;
        Throwable th;
        Throwable th2;
        Closeable closeable = null;
        String str2 = str + (str.trim().length() == 0 ? "" : File.separator) + file.getName();
        if (file.isDirectory()) {
            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File ॱ : listFiles) {
                    ॱ(ॱ, zipOutputStream, str2);
                }
                return;
            }
            return;
        }
        byte[] bArr = new byte[1048576];
        Closeable fileInputStream;
        try {
            fileInputStream = new FileInputStream(file);
            try {
                bufferedInputStream = new BufferedInputStream(fileInputStream, 1048576);
            } catch (Throwable th3) {
                th = th3;
                bufferedInputStream = null;
                closeable = fileInputStream;
                th2 = th;
                dnw.ˎ(bufferedInputStream);
                dnw.ˎ(closeable);
                throw th2;
            }
            try {
                zipOutputStream.putNextEntry(new ZipEntry(str2));
                while (true) {
                    int read = bufferedInputStream.read(bArr);
                    if (read != -1) {
                        zipOutputStream.write(bArr, 0, read);
                    } else {
                        zipOutputStream.flush();
                        zipOutputStream.closeEntry();
                        dnw.ˎ(bufferedInputStream);
                        dnw.ˎ(fileInputStream);
                        return;
                    }
                }
            } catch (Throwable th4) {
                th = th4;
                closeable = fileInputStream;
                th2 = th;
                dnw.ˎ(bufferedInputStream);
                dnw.ˎ(closeable);
                throw th2;
            }
        } catch (Throwable th5) {
            th2 = th5;
            bufferedInputStream = null;
            dnw.ˎ(bufferedInputStream);
            dnw.ˎ(closeable);
            throw th2;
        }
    }
}
